<template>
	<view class="page-fade-in" :style="{opacity: pageOpc}">
		<template v-if="pageOpc">
			<view class="content">
				<view class="input-item flexWrapNo">
					<text>姓名:</text>
					<input placeholder="请输入联系人姓名" placeholder-class="placeholderClass" v-model="username"/>
				</view>
				<view class="input-item flexWrapNo">
					<text>手机号:</text>
					<input placeholder="请输入手机号" type="number" maxlength="11" placeholder-class="placeholderClass" v-model="mobile"/>
				</view>
				<view class="join-btn" @tap="join()">提交</view>
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageOpc:0,
				username:"",
				mobile:""
			}
		},
		onLoad() {
			
		},
		onReady(){
			setTimeout(() => {
				this.pageOpc=1
			}, 100)
		},
		methods: {
			join(){
				if(!this.username){
					this.$tools.showToast('请填写联系人姓名')
					return;
				}else if(!this.mobile){
					this.$tools.showToast('请填写手机号')
					return;
				}else if(this.mobile.length!=11){
					this.$tools.showToast('请填写正确的手机号')
					return;
				}
				this.$request.post(this.$api.join, {
					store_id:uni.getStorageSync('store_id'),
					username:this.username,
					mobile:this.mobile
				}, {
					token:true
				}).then(res => {
					let {
						data = {}
					} = res;
					if (res.code==1) {
						this.$tools.showToast('您的信息已提交，商务人员会尽快联系您')
						setTimeout(() => {
							uni.navigateBack()
						}, 1000)
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.content{
		padding: 18upx 36upx;
	}
	.input-item{
		border-bottom: 1rpx solid #36355E;
		margin-bottom: 20upx;
		padding-bottom: 30upx;
		margin-top: 30upx;
		text,input{
			font-size: 30rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #FFFFFF;
		}
		text{
			min-width: 140upx;
		}
		input{
			flex: auto;
		}
		.placeholderClass{
			font-size: 30rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #FFE577;
		}
	}
	.join-btn{
		width: 398rpx;
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		background: #26BCFD;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		font-size: 36rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		margin: auto;
		margin-top: 64upx;
	}
</style>
